package com.fzj.example.socket.tcp.nonblock.bio;


import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * ClassName: BioServer
 * date: 2019/11/18 10:58
 * Description: 伪异步-非阻塞
 * @author fanzj@bonree.com
 * @since JDK 1.8
 */
public class BioServer {
    //启动端口
    public static int PORT = 8080;
    public static String ADDRESS ="192.168.0.23";
    //
    public static void main(String[] args) {
        try {
            ServerSocket serverSocket=new ServerSocket(PORT);
            System.out.println("服务端已经启动");
            HandlerExecutorPool handlerExecutorPool=new HandlerExecutorPool(50,1000);
            while (true){
                Socket socket=serverSocket.accept();
                //SocketHandler实现读写分离
                handlerExecutorPool.execute(new SocketHandler("server",handlerExecutorPool,socket));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
